import 'package:bilibili/util/color.dart';
import 'package:flutter/material.dart';

class LoginEffect extends StatefulWidget {
  final bool? protect;

  const LoginEffect({Key? key, required this.protect}) : super(key: key);
  @override
  State<LoginEffect> createState() {
    return _LoginEffectState();
  }
}

class _LoginEffectState extends State<LoginEffect> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 10),
      decoration: BoxDecoration(
          color: Colors.grey[100],
          border: Border(bottom: BorderSide(color: Colors.grey.shade300))),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          _image(true),
          SizedBox(
            height: 90,
            width: 135,
            child: Stack(children: [
              Positioned(
                  left: 45,
                  child: Image(
                      width: 90,
                      height: 90,
                      image: AssetImage('assets/images/logo.png'))),
              Image(
                  width: 90,
                  height: 90,
                  image: AssetImage('assets/images/logo.png'))
            ]),
          ),
          _image(false)
        ],
      ),
    );
  }

  _image(bool left) {
    var headLeft = widget.protect ?? false
        ? 'assets/images/head_left_protect.png'
        : 'assets/images/head_left.png';
    var headRight = widget.protect ?? false
        ? 'assets/images/head_right_protect.png'
        : 'assets/images/head_right.png';
    return Image(height: 90, image: AssetImage(left ? headLeft : headRight));
  }
}
